<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
 <title>订单处理__湖北民院校园购物网</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta name="description" content=""/>
 <meta name="format-detection" content="telephone=no" />
 <meta name=""/>
 
<link rel="stylesheet" href="css/tasp.css" />
<link href="css/orderconfirm.css" rel="stylesheet" />
<style>
#page{width:auto;}
#comm-header-inner,#content{width:950px;margin:auto;}
#logo{padding-top:26px;padding-bottom:12px;}
#header .wrap-box{margin-top:-67px;}
#logo .logo{position:relative;overflow:hidden;display:inline-block;width:140px;height:35px;font-size:35px;line-height:35px;color:#f40;}
#logo .logo .i{position:absolute;width:140px;height:35px;top:0;left:0;background:url(http://a.tbcdn.cn/tbsp/img/header/logo.png);}

/* .model_bg{
    position: absolute;
    top:0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,.6);
    z-index: 999;
    display: none;
} */
.my_model{
    position: fixed;
    display: none;
    top:50%;
    left: 50%;
    text-align:center;
   	margin-top: -50px;
    margin-left: -200px;
    z-index: 9999;
    width: 360px;
    height: 120px;
    border: 1px solid #aeaeae;
    border-radius: 3px;
    padding: 20px;
    background: #fff;
}
.my_model .title{
    font-size: 14px;
    color: #3c3c3c;
    font-weight: 700;
    margin-bottom: 20px;
}
.my_model .title .closeModel{
    float: right;
    cursor: pointer;
}
.my_model p{
    line-height:16px;
}
.my_model .opBtn{
    margin-top: 20px;
}
.my_model .opBtn a{
    width: 58px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    -webkit-border-radius: 1px;
    -moz-border-radius: 1px;
    -ms-border-radius: 1px;
    border-radius: 1px;
    display: inline-block;
    margin-right: 10px;
    font-weight: 700;
}
.my_model .dialog-sure{
    background: #52a0e5;
    color: #fff;
    border: 1px solid #52a0e5;
}

.my_model .dialog-close{
    background: #fff;
    border: 1px solid #d9d9d9;
    color: #3c3c3c;
}
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="admin/assets/layer/layer.js" type="text/javascript" ></script>
<script type="text/javascript">
	$(function(){
		var total=0;
		var rebate=$("#rebate").val(); 
		$(".J_ItemTotal").each(function(){
			total+=parseFloat($(this).text());
		});
		$("#money").text(new Number(total*(parseFloat(rebate)/100)).toFixed(2));
		
	    $('.btn-go').click(function () {
	    	var paypwd=$("#paypwd").val();
	    	if(paypwd==null || paypwd==""){
	    		closeM();
	    		layer.msg('请先设置您的支付密码! 为您跳转到安全中心',{icon:2,time:2000});
	    		setTimeout(function(){//两秒后跳转  
	                   location.href='payPassword.jsp';
	            },2000);
	    		return;
	    	}
	        $('.model_bg').fadeIn(300);
	        $('.my_model').fadeIn(300);
	    });
		
		$('.closeModel').click(function () {
	       closeM();
	    });
	    $('.dialog-close').click(function () {
	        closeM();
	    });
	    function closeM() {
	        $('.model_bg').fadeOut(300);
	        $('.my_model').fadeOut(300);
	    }
	    //纭畾鎸夐挳锛岀Щ闄ゅ晢鍝�
	    $('.dialog-sure').click(function () {
	    	var repwd=parseFloat($("#zfpwd").val());
	    	var usermoney=$("#usermoney").val();
	    	var username=$("#username").val();
	    	var totalprice=parseFloat($("#money").text());
	    	if(usermoney<totalprice){
	    		closeM();
	    		layer.msg('对不起，您的余额不足!',{icon:2,time:1500});
	    		return;
	    	}
	    	$.ajax({
				url:"/users/checkPayPwd?username="+username+"&paypwd="+repwd,
				type:"post",
				data:"",
				dataType:"json",
				success:function(data){
					if(data){
	            		balance();
	            	}else{
	            		alert('支付密码错误!');
	            	}
				},
				error:function(){
					alert("ajax创建失败！");
				},
			});
	    	
	    });
		
		function balance(){
       		var orderid=$("#orderid").val();
       		var userid=$("#userid").val();
			$.ajax({
				url:"/orders/balance/"+orderid+"/"+userid,
				type:"post",
				data:"",
				dataType:"json",
				success:function(data){
					if(data){
						location.href='order_submit.jsp';
					}else{
						alert("结算异常！");
					}
				},
				error:function(){
					alert("ajax创建失败！");
				},
			});
		}
		
		$("#J_ShopTotal").text(total);
		$(".user-address").click(function(){
			$("#J_AddrConfirm").text($(this).children("#address").text());
			$("#consignee").text($(this).children("#name").text());
			$("#phone").text($(this).children("#tel").text());
			$(this).prev("[name=address]").attr('checked','checked').siblings("#address").removeAttr("checked");
		});
	});
</script>
</head>
<body data-spm="1">

<div id="page">
<jsp:include page="common/header.jsp"></jsp:include>
 <div id="content" class="grid-c">
	<input type="hidden" id="rebate" value="${user.rank.rebate}">
	<input type="hidden" id="usermoney" value="${user.usermoney}">
	<input type="hidden" id="paypwd" value="${user.paypwd}">
	<input type="hidden" id="username" value="${user.username}">
	<input type="hidden" id="orderid" value="${order.orderid}">
	<input type="hidden" id="userid" value="${user.userid}">
  <div id="address" class="address" style="margin-top: 20px;" data-spm="2">
<form name="addrForm" id="addrForm" action="#">
<h3>确认收货地址
 <span class="manage-address">
 <a href="http://member1.taobao.com/member/fresh/deliver_address.htm" target="_blank" title="管理我的收货地址"
 class="J_MakePoint" data-point-url="http://log.mmstat.com/buy.1.7">管理收货地址</a>
 </span>
</h3>
<ul id="address-list" class="address-list">
	<c:forEach items="${address}" var="as">
     <li class="J_Addr J_MakePoint clearfix  J_DefaultAddr "  data-point-url="http://log.mmstat.com/buy.1.20">
 <s class="J_Marker marker"></s>
 <span class="marker-tip">寄送至</span>
   <div class="address-info">
 <a href="#" class="J_Modify modify J_MakePoint" data-point-url="http://log.mmstat.com/buy.1.21">修改本地址</a>
 <input id="address"
 type="radio"
 value="${as.isdefault}"
 name="address"
  <c:if test="${as.isdefault==0}">checked="true"</c:if>/>
 <label for="addrId_${as.addressid}" class="user-address">
         <span id="address">${as.address}</span> (<span id="name">${as.username }</span> 收) <em id="tel">${as.userphone }</em>
   </label>
 <c:if test="${as.isdefault==0}"><em class="tip" >默认地址</em></c:if>
 </div>
     </li>
   </c:forEach>
     </ul>
<ul id="J_MoreAddress" class="address-list hidden">
     
 </ul>

<div class="address-bar">
 <a href="#" class="new J_MakePoint" id="J_NewAddressBtn">使用新地址</a>
 </div>

</form>
</div>
<form id="J_Form" name="J_Form" action="/auction/order/unity_order_confirm.htm" method="post">
           <div>
 <h3 class="dib">确认订单信息</h3>
 <table cellspacing="0" cellpadding="0" class="order-table" id="J_OrderTable" summary="统一下单订单信息区域">
 <caption style="display: none">统一下单订单信息区域</caption>
 <thead>
 <tr>
 <th class="s-title">店铺宝贝<hr/></th>
 <th class="s-price">单价(元)<hr/></th>
 <th class="s-amount">数量<hr/></th>
 <th class="s-agio">是否包邮<hr/></th>
 <th class="s-total">小计(元)<hr/></th>
 </tr>
 </thead>
     

<tbody data-spm="3" class="J_Shop" data-tbcbid="0" data-outorderid="47285539868"  data-isb2c="false" data-postMode="2" data-sellerid="1704508670">
 
 <c:forEach items="${ogs }" var="og">
 <tr class="item" data-lineid="19614514619:31175333266:35612993875" data-pointRate="0">
 <td class="s-title">
   <a href="#" target="_blank" title="${og.goodsnames}" class="J_MakePoint" data-point-url="http://log.mmstat.com/buy.1.5">
     <img src="${og.goodsthums}" class="itempic"><span class="title J_MakePoint">${og.goodsnames }</span></a>

   <div class="props">
     <span>${og.goodsnames } </span>
         </div>
 <a title="${og.goodsnames}" href="#" target="_blank">
</a>
    <div>
 <%-- <span style="color:gray;">尺寸：${og. }</span> --%>
 </div>
     </td>
 <td class="s-price">
   
  <span class='price '>
 <em class="style-normal-small-black J_ItemPrice">${og.goodsprice }</em>
  </span>
<input type="hidden" name="costprice" value="630.00" class="J_CostPrice" />
</td>
 <td class="s-amount" data-point-url="">
	${og.goodnums }
 </td>
 <td class="s-agio">
       <div class="J_Promotion promotion" data-point-url="">
	   <%-- <c:if test="${good.isPost==0}">包邮</c:if>
	   <c:if test="${good.isPost==1}">不包邮</c:if> --%>
	   	包邮
	   </div>
   </td>
 <td class="s-total">
   
   <span class='price '>
 <em class="style-normal-bold-red J_ItemTotal">${og.goodsprice*og.goodnums }</em>
  </span>
    <input id="furniture_service_list_b_47285539868" type="hidden" name="furniture_service_list_b_47285539868"/>
 </td>
</tr>
</c:forEach>

<tr class="item-service">
 <td colspan="5" class="servicearea" style="display: none"></td>
</tr>

<tr class="blue-line" style="height: 2px;"><td colspan="5"></td></tr>


<tr class="shop-total blue-line">
 <td colspan="5">店铺合计(<span class="J_Exclude" style="display: none">不</span>含运费<span class="J_ServiceText" style="display: none">，服务费</span>)：
   <span class='price g_price '>
 <span>&yen;</span><em class="style-middle-bold-red J_ShopTotal" id="J_ShopTotal">0</em>
  </span>
  <input type="hidden" name="1704508670:2|creditcard" value="false" />
<input type="hidden" id="J_IsLadderGroup" name="isLadderGroup" value="false"/>

   </td>
</tr>
</tbody>
  <tfoot>
 <tr>
 <td colspan="5">

<div class="order-go" data-spm="4">
<div class="J_AddressConfirm address-confirm">
 <div class="kd-popup pop-back" style="margin-bottom: 40px;">
 <div class="box">
 <div class="bd">
 <div class="point-in">
   
   <em class="t">实付款：</em>  <span class='price g_price '>
 <span>&yen;</span><em class="style-large-bold-red"  id="money">${order.realprice}</em>
  </span>
</div>

  <ul >
 <li><em>寄送至:</em><span id="J_AddrConfirm" style="word-break: break-all;">
 	<c:forEach items="${address }" var="as">
 		<c:if test="${as.isdefault==0}">${as.address}</c:if>
 	</c:forEach>
   </span></li>
 <li>
	 <em>收货人:</em>
	 <span id="J_AddrNameConfirm">
	 	<span id="consignee">
	 	<c:forEach items="${address }" var="as">
 		<c:if test="${as.isdefault==0}">${as.username}</c:if>
 		</c:forEach>
	 	</span>
	 	<em>联系电话:</em>
	 	<span id="phone">
	 	<c:forEach items="${address }" var="as">
 		<c:if test="${as.isdefault==0}">${as.userphone}</c:if>
 		</c:forEach>
	 	</span>
	 </span>
 </li>
 </ul>
     </div>
 </div>
         <a href="/cart/findCartByUId?userid=${user.userid }"
 class="back J_MakePoint">返回购物车</a>
       <a id="J_Go" class="btn-go" tabindex="0" title="点击此按钮，提交订单。">提交订单<b class="dpl-button"></b></a>
  </div>
 </div>
 	<form id="frmchekrepwd">
	<section class="model_bg"></section>
   <section class="my_model">
       <p class="title">请输入支付密码：<span class="closeModel">X</span></p>
       <input type="hidden" name="account" value="${user.username }" />
       <p><input type="password" maxlength="6" name="zfpwd" id="zfpwd"></p>
       <div class="opBtn"><a href="javascript:;" class="dialog-sure">确定</a><a href="javascript:;" class="dialog-close">关闭</a></div>
   </section>
  	</form>
 <div class="J_confirmError confirm-error">
 <div class="msg J_shopPointError" style="display: none;"><p class="error">积分点数必须为大于0的整数</p></div>
 </div>


 <div class="msg" style="clear: both;">
 <p class="tips naked" style="float:right;padding-right: 0">若价格变动，请在提交订单后联系卖家改价，并查看已买到的宝贝</p>
 </div>
 </div>
 </td>
 </tr>
 </tfoot>
 </table>
</div>
</form>
</div>
<jsp:include page="common/footer.jsp"></jsp:include>
</div>
</body>
</html>
